from network.network import ClientSocket
from network.package import JsonPackage
import sys
from exception import DisconnectedError

client = ClientSocket("localhost", int(sys.argv[1]))
print(client.sock)
print("connected")
pack = JsonPackage()
pack.setData({"hello":"world"})
try:
    while (1):
        result = client.send(pack)
        x = input()
        print(result)
        if str(x) == 0:
            break
except Exception as e:
    print(e)
finally:
    client.close()
